package com.softer.wxzj.controller;


import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.common.util.ShiroUser;
import com.softer.wxzj.entity.FlowInstance;
import com.softer.wxzj.service.FlowInstanceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * FlowInstanceController class
 * @author zcz
 * @date 2019/1/16
 */
@RestController
@RequestMapping("/flowInstance")
@Slf4j
public class FlowInstanceController {
    @Autowired
    FlowInstanceService flowInstanceService;

    @RequestMapping("/add")
    public CommonResult add(FlowInstance flowInstance) {
        flowInstance.setCreater(ShiroUser.getUserName());
        return flowInstanceService.insert(flowInstance);
    }
    @RequestMapping("/update")
    public CommonResult update(FlowInstance flowInstance) {
        return flowInstanceService.update(flowInstance);
    }
    @RequestMapping("/delete")
    public CommonResult delete(String id) {
        return flowInstanceService.delete(id);
    }
    @RequestMapping("/getList")
    public PageInfo<FlowInstance> getRoleList(Page page, FlowInstance flowInstance) {
        return flowInstanceService.getList(page,flowInstance);
    }


}
